<template>
  <ul @click="handleClick($event)" :class="{ 'dataCol-menu': true }">
    <li v-for="item in menuitem" :class="{ 'selected-item': selectced === item.id }" :key="item.id" :data-id="item.id">
      <span :data-id="item.id">{{ item.modelName }}</span>
      <a-icon type="right" :data-id="item.id" />
      <!-- 点击箭头有问题 -->
    </li>
  </ul>
</template>

<script>
export default {
  name: 'SideMenuOnPage',
  props: {
    menuitem: {
      type: Array,
      default: [],
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      selectced: '0',
    }
  },
  created() {
    this.selectced = '0'
  },
  methods: {
    handleClick(e) {
      if (this.disabled) {
        let { id } = e.target.dataset
        console.log(id, e.target)
        if (id) {
          this.selectced = id
          this.$emit('menuItenId', id)
        }
      }else{
        this.$message.warning('结果生成中不可点击分类选择')
      }
    },
  },
}
</script>

<style lang="less" scoped>
.dataCol-menu {
  list-style-type: none;
  padding: 0;
  margin-top: 5px;
  li {
    width: 100%;
    height: 80px;
    border: 1px solid #8080806b;
    margin-top: 1px;
    border-radius: 20px;
    background-color: #0166f30f;
    padding: 26px 15px;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
  }
  width: 100%;
  height: 630px;
  .selected-item {
    border: 1px solid #ef9325;
    color: #ef9325;
    background-color: #ef93251a;
  }
}
</style>